package com.lmaye.design.patterns.behavioral.strategy;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * --
 *
 * @author lmay.Zhou
 * @date 2021/4/1 23:21
 * @qq 379839355
 * @email lmay@lmaye.com
 * @since JDK1.8
 */
public class StrategyFactory {
    private static final Map<Class<?>, IType<?>> TYPE_MAP = new ConcurrentHashMap<>();

    static {
        TYPE_MAP.put(Integer.class, new IntegerType());
        TYPE_MAP.put(Long.class, new LongType());
        TYPE_MAP.put(String.class, new StringType());
    }

    public static IType<?> getType(Class<?> type) {
        return TYPE_MAP.get(type);
    }
}
